home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tools / vim / src / globals.h < prev    next >
C/C++ Source or Header  |  1995-03-09  |  10KB  |  260 lines

  1. /* vi:ts=4:sw=4
  2.  *
  3.  * VIM - Vi IMproved        by Bram Moolenaar
  4.  *
  5.  * Read the file "credits.txt" for a list of people who contributed.
  6.  * Read the file "uganda.txt" for copying and usage conditions.
  7.  */
  8.  
  9. /*
  10.  * definition of global variables
  11.  *
  12.  * EXTERN is only defined in main.c (and in param.h)
  13.  */
  14.  
  15. #ifndef EXTERN
  16. # define EXTERN extern
  17. # define INIT(x)
  18. #else
  19. # ifndef INIT
  20. #  define INIT(x) x
  21. # endif
  22. #endif
  23.  
  24. /*
  25.  * Number of Rows and Columns in the screen.
  26.  * Must be long to be able to use them as options in param.c.
  27.  */
  28. EXTERN long        Rows;
  29. EXTERN long        Columns;
  30.  
  31. /*
  32.  * Cmdline_row is the row where the command line starts, just below the
  33.  * last window.
  34.  * When the cmdline gets longer than the available space the screen gets
  35.  * scrolled up. After a CTRL-D (show matches), after hitting ':' after
  36.  * "hit return", and for the :global command, the command line is
  37.  * temporaraly moved. The old position is restored with the next call to
  38.  * updateScreen().
  39.  */
  40. EXTERN int        cmdline_row;
  41.  
  42. EXTERN int        redraw_cmdline INIT(= FALSE);    /* cmdline must be redrawn */
  43. EXTERN int        clear_cmdline INIT(= FALSE);    /* cmdline must be cleared */
  44.  
  45. #ifdef WEBB_COMPLETE
  46. /*
  47.  * used for completion on the command line
  48.  */
  49. EXTERN int        expand_context INIT(= CONTEXT_UNKNOWN);
  50. EXTERN char_u    *expand_pattern INIT(= NULL);
  51. EXTERN int        expand_interactively INIT(= FALSE);
  52. #endif /* WEBB_COMPLETE */
  53.  
  54. /*
  55.  * Functions for putting characters in the command line,
  56.  * while keeping NextScreen updated.
  57.  */
  58. EXTERN int        msg_col;
  59. EXTERN int        msg_row;
  60. EXTERN int        msg_scrolled; 
  61. EXTERN char_u    *keep_msg;                    /* message to be shown after redraw */
  62. EXTERN int        msg_highlight INIT(= FALSE);/* message should be highlighted */
  63. EXTERN char_u    *highlight INIT(= NULL);    /* string for start of highlighting */
  64. EXTERN char_u    *unhighlight INIT(= NULL);    /* string for end of highlighting */
  65. EXTERN int        scroll_region INIT(= FALSE);/* terminal supports scroll region */
  66.  
  67. /*
  68.  * All windows are linked in a list. firstwin points to the first entry, lastwin
  69.  * to the last entry (can be the same as firstwin) and curwin to the currently
  70.  * active window.
  71.  */
  72. EXTERN WIN        *firstwin;        /* first window */
  73. EXTERN WIN        *lastwin;        /* last window */
  74. EXTERN WIN        *curwin;        /* currently active window */
  75.  
  76. /*
  77.  * All buffers are linked in a list. 'firstbuf' points to the first entry,
  78.  * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer.
  79.  */
  80. EXTERN BUF        *firstbuf INIT(= NULL);    /* first buffer */
  81. EXTERN BUF        *lastbuf INIT(= NULL);    /* last buffer */
  82. EXTERN BUF        *curbuf INIT(= NULL);    /* currently active buffer */
  83.  
  84. /*
  85.  * list of files being edited (argument list)
  86.  */
  87. EXTERN char_u    **arg_files;    /* list of files */
  88. EXTERN int        arg_count;         /* number of files */
  89. EXTERN int        arg_exp;        /* when TRUE arg_files must be freed */
  90.  
  91. EXTERN int        ru_col;            /* column for ruler */
  92. EXTERN int        sc_col;            /* column for shown command */
  93.  
  94. /*
  95.  * When starting or exiting some things are done differently (e.g. screen
  96.  * updating).
  97.  */
  98. EXTERN int        starting INIT(= TRUE);
  99.                                 /* set to FALSE when starting up finished */
  100. EXTERN int        exiting INIT(= FALSE);
  101.                                 /* set to TRUE when abandoning Vim */
  102.  
  103. EXTERN int        secure INIT(= FALSE);
  104.                                 /* set to TRUE when only "safe" commands are 
  105.                                  * allowed, e.g. when sourcing .exrc or .vimrc
  106.                                  * in current directory */
  107.  
  108. EXTERN FPOS     VIsual;         /* start position of Visual
  109.                                  * (VIsual.lnum == 0 when not active) */
  110. EXTERN int        Visual_block INIT(= FALSE);
  111.                                 /* Visual is blockwise */
  112.  
  113. EXTERN FPOS     Insstart;        /* This is where the latest insert/append
  114.                                  * mode started. */
  115.  
  116. /*
  117.  * This flag is used to make auto-indent work right on lines where only a
  118.  * <RETURN> or <ESC> is typed. It is set when an auto-indent is done, and
  119.  * reset when any other editting is done on the line. If an <ESC> or <RETURN>
  120.  * is received, and did_ai is TRUE, the line is truncated.
  121.  */
  122. EXTERN int               did_ai INIT(= FALSE);
  123.  
  124. /*
  125.  * This flag is set when a smart indent has been performed. When the next typed
  126.  * character is a '{' the inserted tab will be deleted again.
  127.  */
  128. EXTERN int                did_si INIT(= FALSE);
  129.  
  130. /*
  131.  * This flag is set after an auto indent. If the next typed character is a '}'
  132.  * one indent character will be removed.
  133.  */
  134. EXTERN int                can_si INIT(= FALSE);
  135.  
  136. EXTERN int                old_indent INIT(= 0); /* for ^^D command in insert mode */
  137.  
  138. /*
  139.  * This flag is set after doing a reverse replace in column 0.
  140.  * An extra space has been inserted in column 0.
  141.  */
  142. EXTERN int                extraspace INIT(= FALSE);
  143.  
  144. EXTERN int        State INIT(= NORMAL);    /* This is the current state of the command
  145.                                          * interpreter. */
  146.  
  147. EXTERN int        Recording INIT(= FALSE);/* TRUE when recording into a register */
  148. EXTERN int        Exec_reg INIT(= FALSE);    /* TRUE when executing a register */
  149.  
  150. EXTERN int        did_cd INIT(= FALSE);    /* TRUE when :cd dir used */
  151. EXTERN int        no_abbr INIT(= TRUE);    /* TRUE when no abbreviations loaded */
  152.  
  153.  
  154. EXTERN char_u     *IObuff;                /* sprintf's are done in this buffer */
  155. EXTERN char_u    *NameBuff;                /* file names are expanded in this buffer */
  156.  
  157. EXTERN int        RedrawingDisabled INIT(= FALSE);
  158.                                         /* Set to TRUE if doing :g */
  159.  
  160. EXTERN int        readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
  161. EXTERN int        recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
  162.  
  163. EXTERN int        KeyTyped;                    /* TRUE if user typed the character */
  164. EXTERN int        must_redraw INIT(= 0);        /* type of redraw necessary */
  165. EXTERN int        skip_redraw INIT(= FALSE);    /* skip redraw once */
  166.  
  167. #define NSCRIPT 15
  168. EXTERN FILE     *scriptin[NSCRIPT];            /* streams to read script from */
  169. EXTERN int        curscript INIT(= 0);        /* index in scriptin[] */
  170. EXTERN FILE     *scriptout    INIT(= NULL);     /* stream to write script to */
  171.  
  172. EXTERN int        got_int INIT(= FALSE);        /* set to TRUE when interrupt
  173.                                                    signal occurred */
  174. EXTERN int        term_console INIT(= FALSE);    /* set to TRUE when Amiga window used */
  175. EXTERN int        termcap_active INIT(= FALSE);    /* set to TRUE by starttermcap() */
  176. EXTERN int        bangredo INIT(= FALSE);        /* set to TRUE whith ! command */
  177. EXTERN int        searchcmdlen;                /* length of previous search command */
  178. EXTERN int         reg_ic INIT(= 0);             /* p_ic passed to to regexec() */
  179.  
  180. EXTERN int        did_outofmem_msg INIT(= FALSE);    /* set after out of memory msg */
  181. EXTERN int        tag_busy INIT(= FALSE);        /* doing a search for tag command */
  182. EXTERN int        global_busy INIT(= 0);        /* set when :global is executing */
  183. EXTERN int        dont_sleep INIT(= FALSE);    /* set when sleep() in emsg() not wanted */
  184. EXTERN int        did_msg;                    /* set in msg_start, used for :global */
  185. EXTERN int        no_wait_return INIT(= 0);    /* don't wait for return now */
  186. EXTERN int        need_wait_return INIT(= 0);    /* need to wait for return later */
  187. EXTERN char_u    *last_cmdline INIT(= NULL);    /* last command line (for ':' register) */
  188. EXTERN char_u    *new_last_cmdline INIT(= NULL);    /* new value for last_cmdline */
  189.  
  190. EXTERN int        postponed_split INIT(= FALSE);    /* for CTRL-W CTRL-] command */
  191. EXTERN int        keep_old_search_pattern INIT(= FALSE);    /* for myregcomp() */
  192.  
  193. #ifdef DEBUG
  194. EXTERN FILE *debugfp INIT(=NULL);
  195. #endif
  196.  
  197. extern char_u *Version;            /* this is in version.c */
  198. extern char_u *longVersion;        /* this is in version.c */
  199.  
  200. /*
  201.  * The error messages that can be shared are included here.
  202.  * Excluded are very specific errors and debugging messages.
  203.  */
  204. EXTERN char_u e_abbr[]        INIT(="No such abbreviation");
  205. EXTERN char_u e_abort[]        INIT(="Command aborted");
  206. EXTERN char_u e_ambmap[]    INIT(="Ambiguous mapping");
  207. EXTERN char_u e_argreq[]    INIT(="Argument required");
  208. EXTERN char_u e_backslash[]    INIT(="\\ should be followed by /, ? or &");
  209. EXTERN char_u e_curdir[]    INIT(="Command not allowed from from .exrc/.vimrc in current dir");
  210. EXTERN char_u e_errorf[]    INIT(="No errorfile name");
  211. EXTERN char_u e_exists[]    INIT(="File exists (use ! to override)");
  212. EXTERN char_u e_failed[]     INIT(="Command failed");
  213. EXTERN char_u e_internal[]    INIT(="Internal error");
  214. EXTERN char_u e_interr[]    INIT(="Interrupted");
  215. EXTERN char_u e_invaddr[]    INIT(="Invalid address");
  216. EXTERN char_u e_invarg[]    INIT(="Invalid argument");
  217. EXTERN char_u e_invrange[]    INIT(="Invalid range");
  218. EXTERN char_u e_invcmd[]    INIT(="Invalid command");
  219. EXTERN char_u e_invstring[]    INIT(="Invalid search string");
  220. EXTERN char_u e_nesting[]    INIT(="Scripts nested too deep");
  221. EXTERN char_u e_noalt[]        INIT(="No alternate file");
  222. EXTERN char_u e_nolastcmd[]    INIT(="No previous command line");
  223. EXTERN char_u e_nomap[]        INIT(="No such mapping");
  224. EXTERN char_u e_nomatch[]    INIT(="No match");
  225. EXTERN char_u e_nomore[]    INIT(="No more files to edit");
  226. EXTERN char_u e_noname[]    INIT(="No file name");
  227. EXTERN char_u e_nopresub[]    INIT(="No previous substitute");
  228. EXTERN char_u e_noprev[]    INIT(="No previous command");
  229. EXTERN char_u e_noprevre[]    INIT(="No previous regexp");
  230. EXTERN char_u e_norange[]     INIT(="No range allowed");
  231. EXTERN char_u e_noroom[]     INIT(="Not enough room");
  232. EXTERN char_u e_notcreate[]    INIT(="Can't create file %s");
  233. EXTERN char_u e_notmp[]        INIT(="Can't get temp file name");
  234. EXTERN char_u e_notopen[]    INIT(="Can't open file %s");
  235. EXTERN char_u e_notread[]    INIT(="Can't read file %s");
  236. EXTERN char_u e_nowrtmsg[]    INIT(="No write since last change (use ! to override)");
  237. EXTERN char_u e_null[]        INIT(="Null argument");
  238. EXTERN char_u e_number[]    INIT(="Number expected");
  239. EXTERN char_u e_openerrf[]    INIT(="Can't open errorfile %s");
  240. EXTERN char_u e_outofmem[]    INIT(="Out of memory!");
  241. EXTERN char_u e_patnotf[]    INIT(="Pattern not found");
  242. EXTERN char_u e_positive[]    INIT(="Argument must be positive");
  243. EXTERN char_u e_quickfix[]    INIT(="No errorfile; use :cf");
  244. EXTERN char_u e_re_damg[]    INIT(="Damaged match string");
  245. EXTERN char_u e_re_corr[]    INIT(="Corrupted regexp program");
  246. EXTERN char_u e_readonly[]    INIT(="File is readonly");
  247. EXTERN char_u e_readerrf[]    INIT(="Error while reading errorfile");
  248. EXTERN char_u e_scroll[]    INIT(="Invalid scroll size");
  249. EXTERN char_u e_toocompl[]    INIT(="Command too complex");
  250. EXTERN char_u e_toombra[]    INIT(="Too many (");
  251. EXTERN char_u e_toomket[]    INIT(="Too many )");
  252. EXTERN char_u e_toomsbra[]    INIT(="Too many [");
  253. EXTERN char_u e_toolong[]    INIT(="Command too long");
  254. EXTERN char_u e_toomany[]    INIT(="Too many file names");
  255. EXTERN char_u e_trailing[]    INIT(="Trailing characters");
  256. EXTERN char_u e_umark[]        INIT(="Unknown mark");
  257. EXTERN char_u e_unknown[]    INIT(="Unknown");
  258. EXTERN char_u e_write[]        INIT(="Error while writing");
  259. EXTERN char_u e_zerocount[]    INIT(="Zero count");
  260.